﻿@{
    Layout = "~/Areas/Admin/Views/Shared/_LayoutCMS.cshtml";
    ViewBag.Title = "众筹中的项目";
}
@section htmlhead{
    <link href="~/Content/assets/css/Layout/css/main.css" rel="stylesheet" />
    <link href="~/Content/assets/css/plugin/xjgrid.css" rel="stylesheet" />
}
<div class="container">
    <h2>@ViewBag.Title</h2>
    <div id="table" class="mt10">
        <div id="button" class="mt10">
            <form id="formProjectClassEdit" class="form-inline" role="form">
            
            </form>
        </div>
        <div class="box span10 oh">
            <div id="gridlist">
            </div>
        </div>
    </div>
</div>
@section jssection{
    <script src="~/Content/assets/plugins/xjgrid/xjgrid.js"></script>
   
    <script type="text/javascript">
        var api = frameElement.api, W = api.opener;
        var util = {};
        var xjgrid;
        var options = {
            listUrl: "@Url.Action("ProjectList", new { projectStatus = 2 })",//查询状态为2的，就是审核通过
            itemUrl: "@Url.Action("ProjectItemList")",//档位列表
            DetailsUrl: "@Url.Action("Detail","Default",new{area=""})"//项目投资列表
        };
        $(document).ready(function () {
            var gridopt = {
                url: options.listUrl,
                colModel: [
                    { display: '编号', name: 'Id', width: "5%", sortable: true, hide: false, align: 'left', iskey: true },
                    { display: '项目标题', name: 'ProjectName', width: "10%", sortable: false, align: 'left' },
                    { display: '项目分类', name: 'ProjectClass', width: "7%", sortable: false, align: 'left' },
                    { display: '筹资金额', name: 'Amount', width: "7%", sortable: false, align: 'left' },
                    { display: '筹集天数', name: 'CollectDays', width: "7%", sortable: false, align: 'left' },
                    { display: '一句话说明', name: 'ProjectAdWord', width: "7%", sortable: false, hide: true, align: 'left' },
                    { display: '预热图片', name: 'ProjectThumImage1', width: "7%", sortable: false, hide: true, align: 'left' },
                    { display: '创建时间', name: 'AuditTime', width: "7%", sortable: false, align: 'left' },
                    { display: '项目状态', name: 'ProjectStatus', width: "7%", sortable: false, align: 'left' },
                    { display: '操作', name: 'Id', width: "13%", sortable: false, align: 'center', process: processOp }

                ],
                sortname: "Id",
                sortorder: "ASC",
                title: false,
                rp: 15,
                usepager: true,
                showcheckbox: false
            };
             xjgrid = new xjGrid("gridlist", gridopt);
            function processOp(value, cell, rowid) {
                var ops = [];
                ops.push("&nbsp;<a title='选择项目' href='javascript:;'  onclick=\"ok('", rowid, "')\"><i class='fa fa-edit' class='fa fa-trash-o'></i>选择1</a>");
                return ops.join("");
            } 
        }); 
        function ok(rowid) { 
            var cell = xjgrid.options.data[rowid].cell; 
            W.document.getElementById('Name').value = cell[1];
            W.document.getElementById('URL').value = options.DetailsUrl+"/"+cell[0];
            W.document.getElementById('imgShow').src = cell[6];
            W.document.getElementById('fileName').value = cell[6];
            W.document.getElementById('Synopsis').value = cell[5];
            W.document.getElementById('Source').value = cell[0]; 
            api.close();
        };
    </script>  
    <script>
       
    </script>

}
